package com.example.repository;

import com.example.entity.Role;
import com.example.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface UserRepository extends JpaRepository<User, Long> {
    long countByRole(Role role);
    // 根据用户名模糊查询并分页
    Page<User> findByNameContaining(String name, Pageable pageable);

    Optional<User> findByEmail(String email);

    boolean existsByEmail(String mail);
}
